
def read(filename):
    # filename = "test_small.txt"
    customer_num = car_num = capacity = bid_num = 0
    xcoord , ycoord, d, e, l, s = [], [], [], [], [], [] # 变量名称设置规则依据数学模型
    p, B = [], [] # 第三方外包公司
    with open(filename, 'r') as f:
        for index, line in enumerate(f.readlines()):
            line = line.strip('\n')
            if index == 0:
                customer_num = int(line)
            if index == 4:
                car_num, capacity = [int(i) for i in line.split()]
            if index in range(9, 9+customer_num): # 读取顾客信息
                _, x, y, demand, ready_time, due_time, service_time = [int(i) for i in line.split()]
                # print(x, y, demand, ready_time, due_time, service_time)
                xcoord.append(x)
                ycoord.append(y)
                d.append(demand)
                e.append(ready_time)
                l.append(due_time)
                s.append(service_time)
            if index == 9+customer_num+2:
                bid_num = int(line)
            if index in range(customer_num+14, customer_num+15+bid_num):
                text = [i for i in line.split()]
                text.pop(0) # 不需要bid no.
                p.append(float(text.pop(0))) # bid_cost
                text.pop(0) # 不需要costomer number
                B.append([int(i) for i in text]) # covered_customers

        # 在顾客节点最后加上一个补货中心，与配送中心各参数一致，目的是区分开补货和回家
        # xcoord.append(xcoord[0])
        # ycoord.append(ycoord[0])
        # d.append(d[0])
        # e.append(e[0])
        # l.append(l[0])
        # s.append(s[0])

    return customer_num, car_num, capacity, bid_num, xcoord, ycoord, d, e, l, s, p, B